home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7169 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sscanf bug??????
  5. Date: 15 Feb 96 11:41:51 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.824384511@rscernix>
  8. References: <4fimvo$82s@fnord.dfw.net> <4frr9j$ie8@fnord.dfw.net> <4ftdnq$b0c@sun001.spd.dsccc.com>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4ftdnq$b0c@sun001.spd.dsccc.com> jmccarty@spd.dsccc.com (Mike McCarty) writes:
  13.  
  14. >In any case, 013196 (octal) is 718 decimal. 718 decimal mod 256 is 206.
  15.  
  16. Huh???  What algorithm did you use to perform the conversion from octal
  17. to decimal?
  18.  
  19. >I don't see anything reasonable it could be the mod of that would
  20. >result in 89. So even if it is an "undocumented feature" or non-ANSI
  21. >extension, I don't think it is working properly.
  22.  
  23. It _is_ working correctly, assuming %i instead of %d.  sscanf will stop
  24. at the first character which cannot be converted, and this is '9'.
  25. It's very easy to see that 0131 is 89, indeed.
  26.  
  27. BTW, in C, 013196 is not a valid integer constant and the compiler has to
  28. emit a diagnostic.  Of course, this doesn't apply to "integer constants"
  29. stored in string literals :-)
  30.  
  31. Dan
  32. --
  33. Dan Pop
  34. CERN, CN Division
  35. Email: danpop@mail.cern.ch 
  36. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  37.